﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class DayBan : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TimeSpan ts = new TimeSpan(0, 0, 0);
        Response.Cache.SetMaxAge(ts);
        int cid, type;
        if (!int.TryParse(Request.QueryString["id"], out cid))
        {
            return;
        }
        if (!int.TryParse(Request.QueryString["t"], out type))
        {
            return;
        }

        SqlConnection MySqlConnection = new SqlConnection();
        MySqlConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["GoWLLConnectionString"].ConnectionString;
        MySqlConnection.Open();
        SqlCommand MyCommand = new SqlCommand("SELECT [StartDate], [EndDate] FROM [GowllADOrders] WHERE [CID]=" + cid + " AND [Type]=" + type, MySqlConnection);
        SqlDataReader MyReader = MyCommand.ExecuteReader();
        while (MyReader.Read())
        {
            Response.Write("ban('" + MyReader.GetSqlDateTime(0).Value.ToShortDateString() + "','" + MyReader.GetSqlDateTime(1).Value.ToShortDateString() + "');\n");
        }

        MyReader.Close();

    }
}
